const { env } = require('./env')
let dbHost
let dbUser
let dbPwd

const OLD_UPLOAD_URL = env === 'dev' ? 'http://127.0.0.1:8089/book/res/img' : 'http://www.hsx.com/book/res/img'

const UPLOAD_URL = env === 'dev' ? 'http://127.0.0.1:8089/admin-upload-ebook' : 'http://www.hsx.com/admin-upload-ebook'

const UPLOAD_PATH = env === 'dev' ?
  'D:/Project/WEB/video/VUE/ELE/upload/admin-upload-ebook' :
  '/root/upload/admin-upload-ebook'

if (env === 'dev') {
  dbHost = 'localhost'
  dbUser = 'root'
  dbPwd = '12345678'
} else {
  dbHost = '182.92.162.165'
  dbUser = 'root'
  dbPwd = '123456'
}

module.exports = {
  CODE_ERROR: -1,
  CODE_SUCCESS: 0,
  CODE_TOKEN_EXPIRED: -2, // token 错误
  debug: true,
  PWD_SALT: 'admin_imooc_node',
  PRIVATE_KEY: 'admin_imooc_node_test_youbaobao_xyz',  // jwt key
  JWT_EXPIRED: 60 * 60,  // token 过期时间为1小时
  UPLOAD_PATH,
  UPLOAD_URL,
  OLD_UPLOAD_URL,
  MIME_TYPE_EPUB: 'application/epub',
  dbHost,
  dbUser,
  dbPwd
}